package com.puppet.building182.mapper;

import com.puppet.building182.pojo.Log;
import com.puppet.building182.pojo.VO.LogVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LogMapper {

    @Select("select * from sys_log_opt")
    List<Log> getLog();

    @Delete("delete from sys_log_opt where id=#{id}")
    Integer deleteLog(Integer id);

    @Select("select * from sys_log_opt where id=#{id}")
    Log getLogById(Integer id);

    @Insert("insert into sys_log_opt values (default,#{reqType},#{reqUrl},#{fullClass},#{method},#{reqParams},#{respData},now())")
    Integer addLog(Log log);

    @Select("SELECT COUNT(*) AS `value`,req_type AS `name` FROM `sys_log_opt` GROUP BY req_type")
    List<LogVO> getStyle();
}
